package com.tuzhi.sys.jpa.repository;

import com.tuzhi.base.jpa.repository.BaseRepo;
import com.tuzhi.sys.jpa.entity.SysRoleMenuEntity;
import com.tuzhi.sys.jpa.entity.pk.SysRoleMenuPk;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface SysRoleMenuRepo extends BaseRepo<SysRoleMenuEntity, SysRoleMenuPk> {

    @Modifying
    @Query("delete from SysRoleMenuEntity where roleId=:roleId")
    int deleteByRoleId(@Param("roleId") Long roleId);

    int countByRoleId(Long roleId);

    @Modifying
    @Query("delete from SysRoleMenuEntity where menuId=:menuId")
    int deleteByMenuId(@Param("menuId") Long menuId);

    int countByMenuId(Long menuId);

}
